package com.example.android;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.*;

public class InternetAcess extends Activity implements OnClickListener {
	/* Views */
	EditText edit;
	TextView tview;
	Button button;
	
	public void onCreate(Bundle b) {
		super.onCreate(b);
		setContentView(R.layout.internetacess);
		edit = (EditText) findViewById(R.id.internetacessedittext);
		tview = (TextView) findViewById(R.id.internetacesstextview);
		button = (Button) findViewById(R.id.internetacessbutton);
		button.setOnClickListener(this);
		
	}

	@Override
	public void onClick(View view) {
		if(view == button) {
			
		WebView webview = (WebView) findViewById(R.id.webView2);
		WebSettings webSet = webview.getSettings();
		webSet.setSavePassword(false);
		webSet.setSaveFormData(false);
		webSet.setJavaScriptEnabled(true);
		webSet.setSupportZoom(false);
		// Cria a intent com o endereco
		if(edit.getText().toString() != "") {	
			webview.loadUrl("http://".concat(edit.getText().toString())); /* Insere por default http:// */
			}
		}
	}
}
